﻿<Page x:Class="Shell.Metro.MetroTextBoxPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
	Title="MetroTextBoxPage">
    <Page.Resources>

        <Color x:Key="bgColor">#FF1570A6</Color>
        <Color x:Key="bgColorHL">#FF083047</Color>
        <SolidColorBrush x:Key="TextBoxBorderBrush" Color="{StaticResource bgColor}"/>
        <SolidColorBrush x:Key="TextBoxBorderBrushHL" Color="{StaticResource bgColorHL}"/>
        
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderBrush}"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="Disabled"/>
                                    <VisualState x:Name="ReadOnly"/>
                                    <VisualState x:Name="MouseOver"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <Storyboard>
                                                <ColorAnimation Duration="0:0:0.4" To="{StaticResource bgColorHL}" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="Bd"/>
                                            </Storyboard>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ValidationStates">
                                    <VisualState x:Name="Valid"/>
                                    <VisualState x:Name="InvalidFocused"/>
                                    <VisualState x:Name="InvalidUnfocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ScrollViewer x:Name="PART_ContentHost"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <!--<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>-->
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
        <Grid>
        <StackPanel VerticalAlignment="Center">
            <TextBox Height="60" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="120" Margin="5,5,0,0" />
            <TextBox Height="30" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="120" Margin="5,5,0,0" />
            <TextBox Height="30" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="120" Margin="5,5,0,0" />
            <TextBox Height="30" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="120" Margin="5,5,0,0" />
        </StackPanel>
    </Grid>
</Page>
